package com.inspinia.base.api.service;

import com.inspinia.base.api.dao.ExternalInterfaceDao;
import com.inspinia.base.api.model.ExternalInterface;
import com.inspinia.base.dao.BaseDao;
import com.inspinia.base.service.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * 的服务层实现类
 * Created by pujw on 2017-6-30.
 */
@Service
public class ExternalInterfaceServiceImpl extends BaseServiceImpl<ExternalInterface> implements ExternalInterfaceService {
    @Resource
    private ExternalInterfaceDao externalInterfaceDao;

    @Override
    protected BaseDao<ExternalInterface> getDao() {
        return externalInterfaceDao;
    }

    @Transactional
    @Override
    public int batchDelete(Long[] ids) {
        return externalInterfaceDao.batchDelete(ids);
    }

    @Override
    public ExternalInterface findByAddr(String addr) {
        return externalInterfaceDao.findByAddr(addr);
    }

    @Override
    public Boolean addrIsExist(String addr) {
        return externalInterfaceDao.countByAddr(addr) > 0 ? true : false;
    }


    @Override
    public int batchDisable(Long... ids) {
        return externalInterfaceDao.batchDisable(ids);
    }

    @Override
    public int batchEnable(Long... ids) {
        return externalInterfaceDao.batchEnable(ids);
    }

}
